package zaphod.toy.sampleclient;

import java.io.IOException;
import java.io.InputStream;
import java.net.Socket;
import java.net.UnknownHostException;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;


public class SampleClient
{
    /**
     * @param args
     * @throws IOException
     * @throws UnknownHostException
     */
    public static InputStream getInputStream()
        throws UnknownHostException,
            IOException
    {
        Socket socket;
        InputStream is;
        String hostName = "localhost";
        socket = new Socket( hostName, 1025 );
        is = socket.getInputStream();
        socket.getOutputStream().write( 1 );
//        socket.getOutputStream().close();

        return is;

    }


    public static void main( String[] args )
    {
        new SWTApplication()
        {

            @Override
            protected void createControl( Composite parent )
            {
                parent.setLayout( new FillLayout() );
                @SuppressWarnings("unused")
                MainWindow w = new MainWindow( parent, SWT.NONE );

            }
        }.run();
        //
        // Socket socket;
        // InputStream is;
        // String hostName = "localhost";
        // int i;
        //
        // try
        // {
        // socket = new Socket( hostName, 1025 );
        // is = socket.getInputStream();
        // for ( int j = 0; j < 10; j++ )
        // {
        // i = is.read();
        // System.out.println( i );
        // }
        //
        // }
        // catch ( UnknownHostException e )
        // {
        // // TODO Auto-generated catch block
        // e.printStackTrace();
        // }
        // catch ( IOException e )
        // {
        // // TODO Auto-generated catch block
        // e.printStackTrace();
        // }

    }

}
